﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.Api.Application.Command.Get;
using Traceability.App.Api.DTO;
using Traceability.App.ErrorCode;

namespace Traceability.App.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ProductController : ControllerBase
    {
        private readonly IMediator mediator;

        public ProductController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        [HttpGet]
        public Task<ApiResult<List<ProductDTO>>> GetProduct([FromQuery]GetProductCommand request)
        {
            return mediator.Send(request);
        }
    }
}
